#!/usr/bin/env node

// console.log("hello world");

const loading =  require('loading-cli');
const chalk=require("chalk")

const load=loading({
    "text":"正在加载",
    "color":"red",
    "interval":100,
    "stream": process.stdout,
    "frames":['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
}).start()
// start  开始

const str="我花开后百花杀"

// 封装随机颜色
const randomNum=(max,min)=>{
    return Math.floor(Math.random()*(max-min+1))+min
}

setTimeout(()=>{
    console.log(chalk.rgb(randomNum(255,0),randomNum(255,0),randomNum(255,0)).bold(str))
    load.text="加载完成"
    load.color="green"
},2000)

setTimeout(()=>{
    load.stop()  //停止
},3000)